<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QScriptValue Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QScriptValue Class Reference<br /><sup><sup>[<a href="qtscript.html">QtScript</a> module]</sup></sup></h1><p>The QScriptValue class acts as a container for the Qt Script
data types. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qscriptvalue.html#PropertyFlag-enum">PropertyFlag</a></b> { ReadOnly, Undeletable, SkipInEnumeration, PropertyGetter, ..., UserRange }</li><li><div class="fn" />class <b><a href="qscriptvalue-propertyflags.html">PropertyFlags</a></b></li><li><div class="fn" />enum <b><a href="qscriptvalue.html#ResolveFlag-enum">ResolveFlag</a></b> { ResolveLocal, ResolvePrototype, ResolveScope, ResolveFull }</li><li><div class="fn" />class <b><a href="qscriptvalue-resolveflags.html">ResolveFlags</a></b></li><li><div class="fn" />enum <b><a href="qscriptvalue.html#SpecialValue-enum">SpecialValue</a></b> { NullValue, UndefinedValue }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-2">__init__</a></b> (<i>self</i>, QScriptValue&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-3">__init__</a></b> (<i>self</i>, SpecialValue&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-4">__init__</a></b> (<i>self</i>, QScriptEngine&#160;<i>engine</i>, SpecialValue&#160;<i>val</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-5">__init__</a></b> (<i>self</i>, bool&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-6">__init__</a></b> (<i>self</i>, QScriptEngine&#160;<i>engine</i>, bool&#160;<i>val</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-7">__init__</a></b> (<i>self</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-8">__init__</a></b> (<i>self</i>, QScriptEngine&#160;<i>engine</i>, int&#160;<i>val</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-9">__init__</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-10">__init__</a></b> (<i>self</i>, QScriptEngine&#160;<i>engine</i>, float&#160;<i>val</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-11">__init__</a></b> (<i>self</i>, QString&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#QScriptValue-12">__init__</a></b> (<i>self</i>, QScriptEngine&#160;<i>engine</i>, QString&#160;<i>val</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#call">call</a></b> (<i>self</i>, QScriptValue&#160;<i>thisObject</i>&#160;=&#160;QScriptValue(), list-of-QScriptValue&#160;<i>args</i>&#160;=&#160;QScriptValueList())</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#call-2">call</a></b> (<i>self</i>, QScriptValue&#160;<i>thisObject</i>, QScriptValue&#160;<i>arguments</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#construct">construct</a></b> (<i>self</i>, list-of-QScriptValue&#160;<i>args</i>&#160;=&#160;QScriptValueList())</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#construct-2">construct</a></b> (<i>self</i>, QScriptValue&#160;<i>arguments</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" />QScriptEngine <b><a href="qscriptvalue.html#engine">engine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#equals">equals</a></b> (<i>self</i>, QScriptValue&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#instanceOf">instanceOf</a></b> (<i>self</i>, QScriptValue&#160;<i>ctor</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isArray">isArray</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isBool">isBool</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isBoolean">isBoolean</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isDate">isDate</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isError">isError</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isFunction">isFunction</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isNumber">isNumber</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isObject">isObject</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isQMetaObject">isQMetaObject</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isQObject">isQObject</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isRegExp">isRegExp</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isString">isString</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isUndefined">isUndefined</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#isVariant">isVariant</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#lessThan">lessThan</a></b> (<i>self</i>, QScriptValue&#160;<i>other</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#property">property</a></b> (<i>self</i>, QString&#160;<i>name</i>, ResolveFlags&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#property-2">property</a></b> (<i>self</i>, QScriptString&#160;<i>name</i>, ResolveFlags&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#property-3">property</a></b> (<i>self</i>, int&#160;<i>arrayIndex</i>, ResolveFlags&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</li><li><div class="fn" />PropertyFlags <b><a href="qscriptvalue.html#propertyFlags">propertyFlags</a></b> (<i>self</i>, QString&#160;<i>name</i>, ResolveFlags&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</li><li><div class="fn" />PropertyFlags <b><a href="qscriptvalue.html#propertyFlags-2">propertyFlags</a></b> (<i>self</i>, QScriptString&#160;<i>name</i>, ResolveFlags&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#prototype">prototype</a></b> (<i>self</i>)</li><li><div class="fn" />QScriptClass <b><a href="qscriptvalue.html#scriptClass">scriptClass</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setData">setData</a></b> (<i>self</i>, QScriptValue&#160;<i>data</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setProperty">setProperty</a></b> (<i>self</i>, QString&#160;<i>name</i>, QScriptValue&#160;<i>value</i>, PropertyFlags&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setProperty-2">setProperty</a></b> (<i>self</i>, QScriptString&#160;<i>name</i>, QScriptValue&#160;<i>value</i>, PropertyFlags&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setProperty-3">setProperty</a></b> (<i>self</i>, int&#160;<i>arrayIndex</i>, QScriptValue&#160;<i>value</i>, PropertyFlags&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setPrototype">setPrototype</a></b> (<i>self</i>, QScriptValue&#160;<i>prototype</i>)</li><li><div class="fn" /><b><a href="qscriptvalue.html#setScriptClass">setScriptClass</a></b> (<i>self</i>, QScriptClass&#160;<i>scriptClass</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#strictlyEquals">strictlyEquals</a></b> (<i>self</i>, QScriptValue&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#toBool">toBool</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptvalue.html#toBoolean">toBoolean</a></b> (<i>self</i>)</li><li><div class="fn" />QDateTime <b><a href="qscriptvalue.html#toDateTime">toDateTime</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptvalue.html#toInt32">toInt32</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qscriptvalue.html#toInteger">toInteger</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qscriptvalue.html#toNumber">toNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QScriptValue <b><a href="qscriptvalue.html#toObject">toObject</a></b> (<i>self</i>)</li><li><div class="fn" />QMetaObject <b><a href="qscriptvalue.html#toQMetaObject">toQMetaObject</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qscriptvalue.html#toQObject">toQObject</a></b> (<i>self</i>)</li><li><div class="fn" />QRegExp <b><a href="qscriptvalue.html#toRegExp">toRegExp</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qscriptvalue.html#toString">toString</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptvalue.html#toUInt16">toUInt16</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptvalue.html#toUInt32">toUInt32</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qscriptvalue.html#toVariant">toVariant</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QScriptValue class acts as a container for the Qt Script
data types.</p>
<p>QScriptValue supports the types defined in the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> standard: The primitive types, which are Undefined,
Null, Boolean, Number, and String; and the Object type.
Additionally, Qt Script has built-in support for <a href="qvariant.html">QVariant</a>, <a href="qobject.html">QObject</a>
and <a href="qmetaobject.html">QMetaObject</a>.</p>
<p>For the object-based types (including Date and RegExp), use the
newT() functions in <a href="qscriptengine.html">QScriptEngine</a>
(e.g. <a href="qscriptengine.html#newObject">QScriptEngine.newObject</a>()) to
create a QScriptValue of the desired type. For the primitive types,
use one of the QScriptValue constructor overloads.</p>
<p>The methods named isT() (e.g. <a href="qscriptvalue.html#isBool">isBool</a>(), <a href="qscriptvalue.html#isUndefined">isUndefined</a>()) can be used to
test if a value is of a certain type. The methods named toT() (e.g.
<a href="qscriptvalue.html#toBool">toBool</a>(), <a href="qscriptvalue.html#toString">toString</a>()) can be used to convert
a QScriptValue to another type. You can also use the generic
<a href="qscriptvalue.html#qscriptvalue_cast">qscriptvalue_cast</a>()
function.</p>
<p>Object values have zero or more properties which are themselves
QScriptValues. Use <a href="qscriptvalue.html#setProperty">setProperty</a>() to set a property
of an object, and call <a href="qscriptvalue.html#property">property</a>() to retrieve the value
of a property.</p>
<pre class="cpp">
 <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> myEngine;
 <span class="type">QScriptValue</span> myObject <span class="operator">=</span> myEngine<span class="operator">.</span>newObject();
 <span class="type">QScriptValue</span> myOtherObject <span class="operator">=</span> myEngine<span class="operator">.</span>newObject();
 myObject<span class="operator">.</span><a href="qscriptvalue.html#setProperty">setProperty</a>(<span class="string">"myChild"</span><span class="operator">,</span> myOtherObject);
 myObject<span class="operator">.</span><a href="qscriptvalue.html#setProperty">setProperty</a>(<span class="string">"name"</span><span class="operator">,</span> <span class="string">"John Doe"</span>);
</pre>
<p>Each property can have a set of attributes; these are specified
as the third (optional) argument to <a href="qscriptvalue.html#setProperty">setProperty</a>(). The attributes
of a property can be queried by calling the <a href="qscriptvalue.html#propertyFlags">propertyFlags</a>() function. The
following code snippet creates a property that cannot be modified
by script code:</p>
<pre class="cpp">
 <span class="type">QScriptValue</span> val(<span class="operator">&amp;</span>myEngine<span class="operator">,</span> <span class="number">123</span>);
 myObject<span class="operator">.</span><a href="qscriptvalue.html#setProperty">setProperty</a>(<span class="string">"myReadOnlyProperty"</span><span class="operator">,</span> val<span class="operator">,</span> <span class="type">QScriptValue</span><span class="operator">.</span>ReadOnly);
</pre>
<p>If you want to iterate over the properties of a script object,
use the <a href="qscriptvalueiterator.html">QScriptValueIterator</a> class.</p>
<p>Object values have an internal <tt>prototype</tt> property,
which can be accessed with <a href="qscriptvalue.html#prototype">prototype</a>() and <a href="qscriptvalue.html#setPrototype">setPrototype</a>(). Properties
added to a prototype are shared by all objects having that
prototype; this is referred to as prototype-based inheritance. In
practice, it means that (by default) the <a href="qscriptvalue.html#property">property</a>() function will
automatically attempt to look up look the property in the <a href="qscriptvalue.html#prototype">prototype</a>() (and in the prototype
of the <a href="qscriptvalue.html#prototype">prototype</a>(), and
so on), if the object itself does not have the requested property.
Note that this prototype-based lookup is not performed by <a href="qscriptvalue.html#setProperty">setProperty</a>(); <a href="qscriptvalue.html#setProperty">setProperty</a>() will always
create the property in the script object itself. For more
information, see the <a href="qtscript.html">QtScript</a>
documentation.</p>
<p>Function objects (objects for which <a href="qscriptvalue.html#isFunction">isFunction</a>() returns true) can
be invoked by calling <a href="qscriptvalue.html#call">call</a>().
Constructor functions can be used to construct new objects by
calling <a href="qscriptvalue.html#construct">construct</a>().</p>
<p>Use <a href="qscriptvalue.html#equals">equals</a>(), <a href="qscriptvalue.html#strictlyEquals">strictlyEquals</a>() and
<a href="qscriptvalue.html#lessThan">lessThan</a>() to compare a
QScriptValue to another.</p>
<p>Object values can have custom data associated with them; see the
<a href="qscriptvalue.html#setData">setData</a>() and <a href="qscriptvalue.html#data">data</a>() functions. By default, this
data is not accessible to scripts; it can be used to store any data
you want to associate with the script object. Typically this is
used by custom class objects (see <a href="qscriptclass.html">QScriptClass</a>) to store a C++ type that
contains the "native" object data.</p>
<p>Note that a QScriptValue for which <a href="qscriptvalue.html#isObject">isObject</a>() is true only carries a
reference to an actual object; copying the QScriptValue will only
copy the object reference, not the object itself. If you want to
clone an object (i.e. copy an object's properties to another
object), you can do so with the help of a <tt>for-in</tt> statement
in script code, or <a href="qscriptvalueiterator.html">QScriptValueIterator</a> in C++.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="PropertyFlag-enum" />QScriptValue.PropertyFlag</h3><p>This enum describes the attributes of a property.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.ReadOnly</tt></td>
<td class="topAlign"><tt>0x00000001</tt></td>
<td class="topAlign">The property is read-only. Attempts by Qt
Script code to write to the property will be ignored.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.Undeletable</tt></td>
<td class="topAlign"><tt>0x00000002</tt></td>
<td class="topAlign">Attempts by Qt Script code to <tt>delete</tt>
the property will be ignored.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.SkipInEnumeration</tt></td>
<td class="topAlign"><tt>0x00000004</tt></td>
<td class="topAlign">The property is not to be enumerated by a
<tt>for-in</tt> enumeration.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.PropertyGetter</tt></td>
<td class="topAlign"><tt>0x00000008</tt></td>
<td class="topAlign">The property is defined by a function which
will be called to get the property value.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.PropertySetter</tt></td>
<td class="topAlign"><tt>0x00000010</tt></td>
<td class="topAlign">The property is defined by a function which
will be called to set the property value.</td>
</tr>
</table>
<p>This flag is used to indicate that an existing property is a
<a href="qobject.html">QObject</a> member (a property or
method).</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.KeepExistingFlags</tt></td>
<td class="topAlign"><tt>0x00000800</tt></td>
<td class="topAlign">This value is used to indicate to <a href="qscriptvalue.html#setProperty">setProperty</a>() that the
property's flags should be left unchanged. If the property doesn't
exist, the default flags (0) will be used.</td>
</tr>
</table>
<p>Flags in this range are not used by Qt Script, and can be used
for custom purposes.</p>
<p>The PropertyFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;PropertyFlag&gt;. It stores an OR
combination of PropertyFlag values.</p>


<h3 class="fn"><a name="ResolveFlag-enum" />QScriptValue.ResolveFlag</h3><p>This enum specifies how to look up a property of an object.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.ResolveLocal</tt></td>
<td class="topAlign"><tt>0x00</tt></td>
<td class="topAlign">Only check the object's own properties.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.ResolvePrototype</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Check the object's own properties first, then
search the prototype chain. This is the default.</td>
</tr>
</table>
<p>Check the object's own properties first, then search the scope
chain.</p>
<p>Check the object's own properties first, then search the
prototype chain, and finally search the scope chain.</p>
<p>The ResolveFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;ResolveFlag&gt;. It stores an OR
combination of ResolveFlag values.</p>


<h3 class="fn"><a name="SpecialValue-enum" />QScriptValue.SpecialValue</h3><p>This enum is used to specify a single-valued type.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.UndefinedValue</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">An undefined value.</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptValue.NullValue</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A null value.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QScriptValue" />QScriptValue.__init__ (<i>self</i>)</h3><p>Constructs an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>


<h3 class="fn"><a name="QScriptValue-2" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>other</i>)</h3><p>Constructs a new <a href="qscriptvalue.html">QScriptValue</a>
that is a copy of <i>other</i>.</p>
<p>Note that if <i>other</i> is an object (i.e., <a href="qscriptvalue.html#isObject">isObject</a>() would return true),
then only a reference to the underlying object is copied into the
new script value (i.e., the object itself is not copied).</p>


<h3 class="fn"><a name="QScriptValue-3" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptvalue.html#SpecialValue-enum">SpecialValue</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="QScriptValue-4" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptengine.html">QScriptEngine</a>&#160;<i>engine</i>, <a href="qscriptvalue.html#SpecialValue-enum">SpecialValue</a>&#160;<i>val</i>)</h3><h3 class="fn"><a name="QScriptValue-5" />QScriptValue.__init__ (<i>self</i>, bool&#160;<i>value</i>)</h3><h3 class="fn"><a name="QScriptValue-6" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptengine.html">QScriptEngine</a>&#160;<i>engine</i>, bool&#160;<i>val</i>)</h3><h3 class="fn"><a name="QScriptValue-7" />QScriptValue.__init__ (<i>self</i>, int&#160;<i>value</i>)</h3><h3 class="fn"><a name="QScriptValue-8" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptengine.html">QScriptEngine</a>&#160;<i>engine</i>, int&#160;<i>val</i>)</h3><h3 class="fn"><a name="QScriptValue-9" />QScriptValue.__init__ (<i>self</i>, float&#160;<i>value</i>)</h3><h3 class="fn"><a name="QScriptValue-10" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptengine.html">QScriptEngine</a>&#160;<i>engine</i>, float&#160;<i>val</i>)</h3><p>Constructs a new <a href="qscriptvalue.html">QScriptValue</a>
with a special <i>value</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="QScriptValue-11" />QScriptValue.__init__ (<i>self</i>, QString&#160;<i>value</i>)</h3><p>Constructs a new <a href="qscriptvalue.html">QScriptValue</a>
with a boolean <i>value</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="QScriptValue-12" />QScriptValue.__init__ (<i>self</i>, <a href="qscriptengine.html">QScriptEngine</a>&#160;<i>engine</i>, QString&#160;<i>val</i>)</h3><p>Constructs a new <a href="qscriptvalue.html">QScriptValue</a>
with a number <i>value</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="call" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.call (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>thisObject</i>&#160;=&#160;QScriptValue(), list-of-QScriptValue&#160;<i>args</i>&#160;=&#160;QScriptValueList())</h3><p>Calls this <a href="qscriptvalue.html">QScriptValue</a> as a
function, using <i>thisObject</i> as the `this' object in the
function call, and passing <i>args</i> as arguments to the
function. Returns the value returned from the function.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not a
function, call() does nothing and returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p>Note that if <i>thisObject</i> is not an object, the global
object (see <a href="qscriptengine.html#globalObject">QScriptEngine.globalObject</a>())
will be used as the `this' object.</p>
<p>Calling call() can cause an exception to occur in the script
engine; in that case, call() returns the value that was thrown
(typically an <tt>Error</tt> object). You can call <a href="qscriptengine.html#hasUncaughtException">QScriptEngine.hasUncaughtException</a>()
to determine if an exception occurred.</p>
<pre class="cpp">
 <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> engine;
 engine<span class="operator">.</span>evaluate(<span class="string">"function fullName() { return this.firstName + ' ' + this.lastName; }"</span>);
 engine<span class="operator">.</span>evaluate(<span class="string">"somePerson = { firstName: 'John', lastName: 'Doe' }"</span>);

 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> global <span class="operator">=</span> engine<span class="operator">.</span>globalObject();
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> fullName <span class="operator">=</span> global<span class="operator">.</span><a href="qscriptvalue.html#property">property</a>(<span class="string">"fullName"</span>);
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> who <span class="operator">=</span> global<span class="operator">.</span><a href="qscriptvalue.html#property">property</a>(<span class="string">"somePerson"</span>);
 <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> fullName<span class="operator">.</span>call(who)<span class="operator">.</span><a href="qscriptvalue.html#toString">toString</a>(); <span class="comment">// "John Doe"</span>

 engine<span class="operator">.</span>evaluate(<span class="string">"function cube(x) { return x * x * x; }"</span>);
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> cube <span class="operator">=</span> global<span class="operator">.</span><a href="qscriptvalue.html#property">property</a>(<span class="string">"cube"</span>);
 <span class="type">QScriptValueList</span> args;
 args <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="number">3</span>;
 <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> cube<span class="operator">.</span>call(<span class="type"><a href="qscriptvalue.html">QScriptValue</a></span>()<span class="operator">,</span> args)<span class="operator">.</span><a href="qscriptvalue.html#toNumber">toNumber</a>(); <span class="comment">// 27</span>
</pre>
<p><b>See also</b> <a href="qscriptvalue.html#construct">construct</a>().</p>


<h3 class="fn"><a name="call-2" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.call (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>thisObject</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>arguments</i>)</h3><p>Calls this <a href="qscriptvalue.html">QScriptValue</a> as a
function, using <i>thisObject</i> as the `this' object in the
function call, and passing <i>arguments</i> as arguments to the
function. Returns the value returned from the function.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not a
function, <a href="qscriptvalue.html#call">call</a>() does nothing
and returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p><i>arguments</i> can be an arguments object, an array, null or
undefined; any other type will cause a TypeError to be thrown.</p>
<p>Note that if <i>thisObject</i> is not an object, the global
object (see <a href="qscriptengine.html#globalObject">QScriptEngine.globalObject</a>())
will be used as the `this' object.</p>
<p>One common usage of this function is to forward native function
calls to another function:</p>
<pre class="cpp">
 <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> myNativeFunction(<span class="type"><a href="qscriptcontext.html">QScriptContext</a></span> <span class="operator">*</span>ctx<span class="operator">,</span> <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> otherFunction <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;
     <span class="keyword">return</span> otherFunction<span class="operator">.</span>call(ctx<span class="operator">-</span><span class="operator">&gt;</span>thisObject()<span class="operator">,</span> ctx<span class="operator">-</span><span class="operator">&gt;</span>argumentsObject());
 }
</pre>
<p><b>See also</b> <a href="qscriptvalue.html#construct">construct</a>() and <a href="qscriptcontext.html#argumentsObject">QScriptContext.argumentsObject</a>().</p>


<h3 class="fn"><a name="construct" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.construct (<i>self</i>, list-of-QScriptValue&#160;<i>args</i>&#160;=&#160;QScriptValueList())</h3><p>Creates a new <tt>Object</tt> and calls this <a href="qscriptvalue.html">QScriptValue</a> as a constructor, using the
created object as the `this' object and passing <i>args</i> as
arguments. If the return value from the constructor call is an
object, then that object is returned; otherwise the default
constructed object is returned.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not a
function, construct() does nothing and returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p>Calling construct() can cause an exception to occur in the
script engine; in that case, construct() returns the value that was
thrown (typically an <tt>Error</tt> object). You can call <a href="qscriptengine.html#hasUncaughtException">QScriptEngine.hasUncaughtException</a>()
to determine if an exception occurred.</p>
<p><b>See also</b> <a href="qscriptvalue.html#call">call</a>() and
<a href="qscriptengine.html#newObject">QScriptEngine.newObject</a>().</p>


<h3 class="fn"><a name="construct-2" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.construct (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>arguments</i>)</h3><p>Creates a new <tt>Object</tt> and calls this <a href="qscriptvalue.html">QScriptValue</a> as a constructor, using the
created object as the `this' object and passing <i>arguments</i> as
arguments. If the return value from the constructor call is an
object, then that object is returned; otherwise the default
constructed object is returned.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not a
function, <a href="qscriptvalue.html#construct">construct</a>()
does nothing and returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p><i>arguments</i> can be an arguments object, an array, null or
undefined. Any other type will cause a TypeError to be thrown.</p>
<p><b>See also</b> <a href="qscriptvalue.html#call">call</a>(),
<a href="qscriptengine.html#newObject">QScriptEngine.newObject</a>(), and
<a href="qscriptcontext.html#argumentsObject">QScriptContext.argumentsObject</a>().</p>


<h3 class="fn"><a name="data" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.data (<i>self</i>)</h3><p>Returns the internal data of this <a href="qscriptvalue.html">QScriptValue</a> object. <a href="qtscript.html">QtScript</a> uses this property to store the
primitive value of Date, String, Number and Boolean objects. For
other types of object, custom data may be stored using <a href="qscriptvalue.html#setData">setData</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptvalue.html#setData">setData</a>().</p>


<h3 class="fn"><a name="engine" /><a href="qscriptengine.html">QScriptEngine</a> QScriptValue.engine (<i>self</i>)</h3><p>Returns the <a href="qscriptengine.html">QScriptEngine</a> that
created this <a href="qscriptvalue.html">QScriptValue</a>, or 0 if
this <a href="qscriptvalue.html">QScriptValue</a> is invalid or the
value is not associated with a particular engine.</p>


<h3 class="fn"><a name="equals" />bool QScriptValue.equals (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>other</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is equal to <i>other</i>,
otherwise returns false. The comparison follows the behavior
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 11.9.3, "The Abstract Equality Comparison
Algorithm".</p>
<p>This function can return true even if the type of this <a href="qscriptvalue.html">QScriptValue</a> is different from the type of
the <i>other</i> value; i.e. the comparison is not strict. For
example, comparing the number 9 to the string "9" returns true;
comparing an undefined value to a null value returns true;
comparing a <tt>Number</tt> object whose primitive value is 6 to a
<tt>String</tt> object whose primitive value is "6" returns true;
and comparing the number 1 to the boolean value <tt>true</tt>
returns true. If you want to perform a comparison without such
implicit value conversion, use <a href="qscriptvalue.html#strictlyEquals">strictlyEquals</a>().</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
or the <i>other</i> value are objects, calling this function has
side effects on the script engine, since the engine will call the
object's valueOf() function (and possibly <a href="qscriptvalue.html#toString">toString</a>()) in an attempt to
convert the object to a primitive value (possibly resulting in an
uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#strictlyEquals">strictlyEquals</a>() and
<a href="qscriptvalue.html#lessThan">lessThan</a>().</p>


<h3 class="fn"><a name="instanceOf" />bool QScriptValue.instanceOf (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>ctor</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is an instance of
<i>other</i>; otherwise returns false.</p>
<p>This <a href="qscriptvalue.html">QScriptValue</a> is considered
to be an instance of <i>other</i> if <i>other</i> is a function and
the value of the <tt>prototype</tt> property of <i>other</i> is in
the prototype chain of this <a href="qscriptvalue.html">QScriptValue</a>.</p>


<h3 class="fn"><a name="isArray" />bool QScriptValue.isArray (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is an object of the Array
class; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptengine.html#newArray">QScriptEngine.newArray</a>().</p>


<h3 class="fn"><a name="isBool" />bool QScriptValue.isBool (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the primitive type
Boolean; otherwise returns false.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toBool">toBool</a>().</p>


<h3 class="fn"><a name="isBoolean" />bool QScriptValue.isBoolean (<i>self</i>)</h3><h3 class="fn"><a name="isDate" />bool QScriptValue.isDate (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is an object of the Date
class; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptengine.html#newDate">QScriptEngine.newDate</a>().</p>


<h3 class="fn"><a name="isError" />bool QScriptValue.isError (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is an object of the Error
class; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptcontext.html#throwError">QScriptContext.throwError</a>().</p>


<h3 class="fn"><a name="isFunction" />bool QScriptValue.isFunction (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is a function; otherwise
returns false.</p>
<p><b>See also</b> <a href="qscriptvalue.html#call">call</a>().</p>


<h3 class="fn"><a name="isNull" />bool QScriptValue.isNull (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the primitive type Null;
otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptengine.html#nullValue">QScriptEngine.nullValue</a>().</p>


<h3 class="fn"><a name="isNumber" />bool QScriptValue.isNumber (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the primitive type
Number; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toNumber">toNumber</a>().</p>


<h3 class="fn"><a name="isObject" />bool QScriptValue.isObject (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the Object type;
otherwise returns false.</p>
<p>Note that function values, variant values, and <a href="qobject.html">QObject</a> values are objects, so this function
returns true for such values.</p>
<p><b>See also</b> <a class="obsolete" href="qscriptvalue-obsolete.html#toObject">toObject</a>() and <a href="qscriptengine.html#newObject">QScriptEngine.newObject</a>().</p>


<h3 class="fn"><a name="isQMetaObject" />bool QScriptValue.isQMetaObject (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is a <a href="qmetaobject.html">QMetaObject</a>; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toQMetaObject">toQMetaObject</a>() and <a href="qscriptengine.html#newQMetaObject">QScriptEngine.newQMetaObject</a>().</p>


<h3 class="fn"><a name="isQObject" />bool QScriptValue.isQObject (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is a <a href="qobject.html">QObject</a>; otherwise returns false.</p>
<p>Note: This function returns true even if the <a href="qobject.html">QObject</a> that this <a href="qscriptvalue.html">QScriptValue</a> wraps has been deleted.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toQObject">toQObject</a>() and <a href="qscriptengine.html#newQObject">QScriptEngine.newQObject</a>().</p>


<h3 class="fn"><a name="isRegExp" />bool QScriptValue.isRegExp (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is an object of the RegExp
class; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptengine.html#newRegExp">QScriptEngine.newRegExp</a>().</p>


<h3 class="fn"><a name="isString" />bool QScriptValue.isString (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the primitive type
String; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toString">toString</a>().</p>


<h3 class="fn"><a name="isUndefined" />bool QScriptValue.isUndefined (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is of the primitive type
Undefined; otherwise returns false.</p>
<p><b>See also</b> <a href="qscriptengine.html#undefinedValue">QScriptEngine.undefinedValue</a>().</p>


<h3 class="fn"><a name="isValid" />bool QScriptValue.isValid (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is valid; otherwise returns
false.</p>


<h3 class="fn"><a name="isVariant" />bool QScriptValue.isVariant (<i>self</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is a variant value; otherwise
returns false.</p>
<p><b>See also</b> <a href="qscriptvalue.html#toVariant">toVariant</a>() and <a href="qscriptengine.html#newVariant">QScriptEngine.newVariant</a>().</p>


<h3 class="fn"><a name="lessThan" />bool QScriptValue.lessThan (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>other</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is less than <i>other</i>,
otherwise returns false. The comparison follows the behavior
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 11.8.5, "The Abstract Relational Comparison
Algorithm".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
or the <i>other</i> value are objects, calling this function has
side effects on the script engine, since the engine will call the
object's valueOf() function (and possibly <a href="qscriptvalue.html#toString">toString</a>()) in an attempt to
convert the object to a primitive value (possibly resulting in an
uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#equals">equals</a>().</p>


<h3 class="fn"><a name="property" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.property (<i>self</i>, QString&#160;<i>name</i>, <a href="qscriptvalue-resolveflags.html">ResolveFlags</a>&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</h3><p>Returns the value of this <a href="qscriptvalue.html">QScriptValue</a>'s property with the given
<i>name</i>, using the given <i>mode</i> to resolve the
property.</p>
<p>If no such property exists, an invalid <a href="qscriptvalue.html">QScriptValue</a> is returned.</p>
<p>If the property is implemented using a getter function (i.e. has
the <a href="qscriptvalue.html#PropertyFlag-enum">PropertyGetter</a> flag set),
calling property() has side-effects on the script engine, since the
getter function will be called (possibly resulting in an uncaught
script exception). If an exception occurred, property() returns the
value that was thrown (typically an <tt>Error</tt> object).</p>
<p><b>See also</b> <a href="qscriptvalue.html#setProperty">setProperty</a>(), <a href="qscriptvalue.html#propertyFlags">propertyFlags</a>(), and <a href="qscriptvalueiterator.html">QScriptValueIterator</a>.</p>


<h3 class="fn"><a name="property-2" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.property (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>name</i>, <a href="qscriptvalue-resolveflags.html">ResolveFlags</a>&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</h3><p>Returns the value of this <a href="qscriptvalue.html">QScriptValue</a>'s property with the given
<i>name</i>, using the given <i>mode</i> to resolve the
property.</p>
<p>This overload of <a href="qscriptvalue.html#property">property</a>() is useful when you need
to look up the same property repeatedly, since the lookup can be
performed faster when the name is represented as an interned
string.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptengine.html#toStringHandle">QScriptEngine.toStringHandle</a>()
and <a href="qscriptvalue.html#setProperty">setProperty</a>().</p>


<h3 class="fn"><a name="property-3" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.property (<i>self</i>, int&#160;<i>arrayIndex</i>, <a href="qscriptvalue-resolveflags.html">ResolveFlags</a>&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</h3><p>This is an overloaded function.</p>
<p>Returns the property at the given <i>arrayIndex</i>, using the
given <i>mode</i> to resolve the property.</p>
<p>This function is provided for convenience and performance when
working with array objects.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not an
Array object, this function behaves as if <a href="qscriptvalue.html#property">property</a>() was called with the
string representation of <i>arrayIndex</i>.</p>


<h3 class="fn"><a name="propertyFlags" /><a href="qscriptvalue-propertyflags.html">PropertyFlags</a> QScriptValue.propertyFlags (<i>self</i>, QString&#160;<i>name</i>, <a href="qscriptvalue-resolveflags.html">ResolveFlags</a>&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</h3><p>Returns the flags of the property with the given <i>name</i>,
using the given <i>mode</i> to resolve the property.</p>
<p><b>See also</b> <a href="qscriptvalue.html#property">property</a>().</p>


<h3 class="fn"><a name="propertyFlags-2" /><a href="qscriptvalue-propertyflags.html">PropertyFlags</a> QScriptValue.propertyFlags (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>name</i>, <a href="qscriptvalue-resolveflags.html">ResolveFlags</a>&#160;<i>mode</i>&#160;=&#160;QScriptValue.ResolvePrototype)</h3><p>Returns the flags of the property with the given <i>name</i>,
using the given <i>mode</i> to resolve the property.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptvalue.html#property">property</a>().</p>


<h3 class="fn"><a name="prototype" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.prototype (<i>self</i>)</h3><p>If this <a href="qscriptvalue.html">QScriptValue</a> is an
object, returns the internal prototype (<tt>__proto__</tt>
property) of this object; otherwise returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p><b>See also</b> <a href="qscriptvalue.html#setPrototype">setPrototype</a>() and <a href="qscriptvalue.html#isObject">isObject</a>().</p>


<h3 class="fn"><a name="scriptClass" /><a href="qscriptclass.html">QScriptClass</a> QScriptValue.scriptClass (<i>self</i>)</h3><p>Returns the custom script class that this script object is an
instance of, or 0 if the object is not of a custom class.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptvalue.html#setScriptClass">setScriptClass</a>().</p>


<h3 class="fn"><a name="setData" />QScriptValue.setData (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>data</i>)</h3><p>Sets the internal <i>data</i> of this <a href="qscriptvalue.html">QScriptValue</a> object. You can use this
function to set object-specific data that won't be directly
accessible to scripts, but may be retrieved in C++ using the
<a href="qscriptvalue.html#data">data</a>() function.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptvalue.html#data">data</a>() and
<a href="qscriptengine.html#reportAdditionalMemoryCost">QScriptEngine.reportAdditionalMemoryCost</a>().</p>


<h3 class="fn"><a name="setProperty" />QScriptValue.setProperty (<i>self</i>, QString&#160;<i>name</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>value</i>, <a href="qscriptvalue-propertyflags.html">PropertyFlags</a>&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</h3><p>Sets the value of this <a href="qscriptvalue.html">QScriptValue</a>'s property with the given
<i>name</i> to the given <i>value</i>.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not an
object, this function does nothing.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> does not
already have a property with name <i>name</i>, a new property is
created; the given <i>flags</i> then specify how this property may
be accessed by script code.</p>
<p>If <i>value</i> is invalid, the property is removed.</p>
<p>If the property is implemented using a setter function (i.e. has
the <a href="qscriptvalue.html#PropertyFlag-enum">PropertySetter</a> flag set),
calling setProperty() has side-effects on the script engine, since
the setter function will be called with the given <i>value</i> as
argument (possibly resulting in an uncaught script exception).</p>
<p>Note that you cannot specify custom getter or setter functions
for built-in properties, such as the <tt>length</tt> property of
Array objects or meta properties of <a href="qobject.html">QObject</a> objects.</p>
<p><b>See also</b> <a href="qscriptvalue.html#property">property</a>().</p>


<h3 class="fn"><a name="setProperty-2" />QScriptValue.setProperty (<i>self</i>, <a href="qscriptstring.html">QScriptString</a>&#160;<i>name</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>value</i>, <a href="qscriptvalue-propertyflags.html">PropertyFlags</a>&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</h3><p>Sets the value of this <a href="qscriptvalue.html">QScriptValue</a>'s property with the given
<i>name</i> to the given <i>value</i>. The given <i>flags</i>
specify how this property may be accessed by script code.</p>
<p>This overload of <a href="qscriptvalue.html#setProperty">setProperty</a>() is useful when
you need to set the same property repeatedly, since the operation
can be performed faster when the name is represented as an interned
string.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptengine.html#toStringHandle">QScriptEngine.toStringHandle</a>().</p>


<h3 class="fn"><a name="setProperty-3" />QScriptValue.setProperty (<i>self</i>, int&#160;<i>arrayIndex</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>value</i>, <a href="qscriptvalue-propertyflags.html">PropertyFlags</a>&#160;<i>flags</i>&#160;=&#160;QScriptValue.KeepExistingFlags)</h3><p>This is an overloaded function.</p>
<p>Sets the property at the given <i>arrayIndex</i> to the given
<i>value</i>.</p>
<p>This function is provided for convenience and performance when
working with array objects.</p>
<p>If this <a href="qscriptvalue.html">QScriptValue</a> is not an
Array object, this function behaves as if <a href="qscriptvalue.html#setProperty">setProperty</a>() was called with
the string representation of <i>arrayIndex</i>.</p>


<h3 class="fn"><a name="setPrototype" />QScriptValue.setPrototype (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>prototype</i>)</h3><p>If this <a href="qscriptvalue.html">QScriptValue</a> is an
object, sets the internal prototype (<tt>__proto__</tt> property)
of this object to be <i>prototype</i>; otherwise does nothing.</p>
<p>The internal prototype should not be confused with the public
property with name "prototype"; the public prototype is usually
only set on functions that act as constructors.</p>
<p><b>See also</b> <a href="qscriptvalue.html#prototype">prototype</a>() and <a href="qscriptvalue.html#isObject">isObject</a>().</p>


<h3 class="fn"><a name="setScriptClass" />QScriptValue.setScriptClass (<i>self</i>, <a href="qscriptclass.html">QScriptClass</a>&#160;<i>scriptClass</i>)</h3><p>Sets the custom script class of this script object to
<i>scriptClass</i>. This can be used to "promote" a plain script
object (e.g. created by the "new" operator in a script, or by
<a href="qscriptengine.html#newObject">QScriptEngine.newObject</a>() in
C++) to an object of a custom type.</p>
<p>If <i>scriptClass</i> is 0, the object will be demoted to a
plain script object.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qscriptvalue.html#scriptClass">scriptClass</a>() and <a href="qscriptvalue.html#setData">setData</a>().</p>


<h3 class="fn"><a name="strictlyEquals" />bool QScriptValue.strictlyEquals (<i>self</i>, <a href="qscriptvalue.html">QScriptValue</a>&#160;<i>other</i>)</h3><p>Returns true if this <a href="qscriptvalue.html">QScriptValue</a> is equal to <i>other</i> using
strict comparison (no conversion), otherwise returns false. The
comparison follows the behavior described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 11.9.6, "The Strict Equality Comparison
Algorithm".</p>
<p>If the type of this <a href="qscriptvalue.html">QScriptValue</a>
is different from the type of the <i>other</i> value, this function
returns false. If the types are equal, the result depends on the
type, as shown in the following table:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Type</th>
<th>Result</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Undefined</td>
<td>true</td>
</tr>
<tr class="even" valign="top">
<td>Null</td>
<td>true</td>
</tr>
<tr class="odd" valign="top">
<td>Boolean</td>
<td>true if both values are true, false otherwise</td>
</tr>
<tr class="even" valign="top">
<td>Number</td>
<td>false if either value is NaN (Not-a-Number); true if values are
equal, false otherwise</td>
</tr>
<tr class="odd" valign="top">
<td>String</td>
<td>true if both values are exactly the same sequence of
characters, false otherwise</td>
</tr>
<tr class="even" valign="top">
<td>Object</td>
<td>true if both values refer to the same object, false
otherwise</td>
</tr>
</table>
<p><b>See also</b> <a href="qscriptvalue.html#equals">equals</a>().</p>


<h3 class="fn"><a name="toBool" />bool QScriptValue.toBool (<i>self</i>)</h3><p>Returns the boolean value of this <a href="qscriptvalue.html">QScriptValue</a>, using the conversion rules
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.2, "ToBoolean".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qscriptvalue.html#isBool">isBool</a>().</p>


<h3 class="fn"><a name="toBoolean" />bool QScriptValue.toBoolean (<i>self</i>)</h3><h3 class="fn"><a name="toDateTime" /><a href="qdatetime.html">QDateTime</a> QScriptValue.toDateTime (<i>self</i>)</h3><p>Returns a <a href="qdatetime.html">QDateTime</a> representation
of this value, in local time. If this <a href="qscriptvalue.html">QScriptValue</a> is not a date, or the value of
the date is NaN (Not-a-Number), an invalid <a href="qdatetime.html">QDateTime</a> is returned.</p>
<p><b>See also</b> <a href="qscriptvalue.html#isDate">isDate</a>().</p>


<h3 class="fn"><a name="toInt32" />int QScriptValue.toInt32 (<i>self</i>)</h3><p>Returns the signed 32-bit integer value of this <a href="qscriptvalue.html">QScriptValue</a>, using the conversion rules
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.5, "ToInt32".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#toNumber">toNumber</a>() and <a href="qscriptvalue.html#toUInt32">toUInt32</a>().</p>


<h3 class="fn"><a name="toInteger" />float QScriptValue.toInteger (<i>self</i>)</h3><p>Returns the integer value of this <a href="qscriptvalue.html">QScriptValue</a>, using the conversion rules
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.4, "ToInteger".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#toNumber">toNumber</a>().</p>


<h3 class="fn"><a name="toNumber" />float QScriptValue.toNumber (<i>self</i>)</h3><p>Returns the number value of this <a href="qscriptvalue.html">QScriptValue</a>, as defined in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.3, "ToNumber".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#isNumber">isNumber</a>(), <a href="qscriptvalue.html#toInteger">toInteger</a>(), <a href="qscriptvalue.html#toInt32">toInt32</a>(), <a href="qscriptvalue.html#toUInt32">toUInt32</a>(), and <a href="qscriptvalue.html#toUInt16">toUInt16</a>().</p>


<h3 class="fn"><a name="toObject" /><a href="qscriptvalue.html">QScriptValue</a> QScriptValue.toObject (<i>self</i>)</h3><h3 class="fn"><a name="toQMetaObject" /><a href="qmetaobject.html">QMetaObject</a> QScriptValue.toQMetaObject (<i>self</i>)</h3><p>If this <a href="qscriptvalue.html">QScriptValue</a> is a
<a href="qmetaobject.html">QMetaObject</a>, returns the <a href="qmetaobject.html">QMetaObject</a> pointer that the <a href="qscriptvalue.html">QScriptValue</a> represents; otherwise, returns
0.</p>
<p><b>See also</b> <a href="qscriptvalue.html#isQMetaObject">isQMetaObject</a>().</p>


<h3 class="fn"><a name="toQObject" /><a href="qobject.html">QObject</a> QScriptValue.toQObject (<i>self</i>)</h3><p>If this <a href="qscriptvalue.html">QScriptValue</a> is a
<a href="qobject.html">QObject</a>, returns the <a href="qobject.html">QObject</a> pointer that the <a href="qscriptvalue.html">QScriptValue</a> represents; otherwise, returns
0.</p>
<p>If the <a href="qobject.html">QObject</a> that this <a href="qscriptvalue.html">QScriptValue</a> wraps has been deleted, this
function returns 0 (i.e. it is possible for toQObject() to return 0
even when <a href="qscriptvalue.html#isQObject">isQObject</a>()
returns true).</p>
<p><b>See also</b> <a href="qscriptvalue.html#isQObject">isQObject</a>().</p>


<h3 class="fn"><a name="toRegExp" /><a href="qregexp.html">QRegExp</a> QScriptValue.toRegExp (<i>self</i>)</h3><p>Returns the <a href="qregexp.html">QRegExp</a> representation of
this value. If this <a href="qscriptvalue.html">QScriptValue</a> is
not a regular expression, an empty <a href="qregexp.html">QRegExp</a> is returned.</p>
<p><b>See also</b> <a href="qscriptvalue.html#isRegExp">isRegExp</a>().</p>


<h3 class="fn"><a name="toString" />QString QScriptValue.toString (<i>self</i>)</h3><p>Returns the string value of this <a href="qscriptvalue.html">QScriptValue</a>, as defined in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.8, "ToString".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's toString() function
(and possibly valueOf()) in an attempt to convert the object to a
primitive value (possibly resulting in an uncaught script
exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#isString">isString</a>().</p>


<h3 class="fn"><a name="toUInt16" />int QScriptValue.toUInt16 (<i>self</i>)</h3><p>Returns the unsigned 16-bit integer value of this <a href="qscriptvalue.html">QScriptValue</a>, using the conversion rules
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.7, "ToUint16".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#toNumber">toNumber</a>().</p>


<h3 class="fn"><a name="toUInt32" />int QScriptValue.toUInt32 (<i>self</i>)</h3><p>Returns the unsigned 32-bit integer value of this <a href="qscriptvalue.html">QScriptValue</a>, using the conversion rules
described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
ECMA-262</a> section 9.6, "ToUint32".</p>
<p>Note that if this <a href="qscriptvalue.html">QScriptValue</a>
is an object, calling this function has side effects on the script
engine, since the engine will call the object's valueOf() function
(and possibly <a href="qscriptvalue.html#toString">toString</a>())
in an attempt to convert the object to a primitive value (possibly
resulting in an uncaught script exception).</p>
<p><b>See also</b> <a href="qscriptvalue.html#toNumber">toNumber</a>() and <a href="qscriptvalue.html#toInt32">toInt32</a>().</p>


<h3 class="fn"><a name="toVariant" />QVariant QScriptValue.toVariant (<i>self</i>)</h3><p>Returns the <a href="qvariant.html">QVariant</a> value of this
<a href="qscriptvalue.html">QScriptValue</a>, if it can be
converted to a <a href="qvariant.html">QVariant</a>; otherwise
returns an invalid <a href="qvariant.html">QVariant</a>. The
conversion is performed according to the following table:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Input Type</th>
<th>Result</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Undefined</td>
<td>An invalid <a href="qvariant.html">QVariant</a>.</td>
</tr>
<tr class="even" valign="top">
<td>Null</td>
<td>An invalid <a href="qvariant.html">QVariant</a>.</td>
</tr>
<tr class="odd" valign="top">
<td>Boolean</td>
<td>A <a href="qvariant.html">QVariant</a> containing the value of
the boolean.</td>
</tr>
<tr class="even" valign="top">
<td>Number</td>
<td>A <a href="qvariant.html">QVariant</a> containing the value of
the number.</td>
</tr>
<tr class="odd" valign="top">
<td>String</td>
<td>A <a href="qvariant.html">QVariant</a> containing the value of
the string.</td>
</tr>
<tr class="even" valign="top">
<td><a href="qvariant.html">QVariant</a> Object</td>
<td>The result is the <a href="qvariant.html">QVariant</a> value of
the object (no conversion).</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qobject.html">QObject</a> Object</td>
<td>A <a href="qvariant.html">QVariant</a> containing a pointer to
the <a href="qobject.html">QObject</a>.</td>
</tr>
<tr class="even" valign="top">
<td>Date Object</td>
<td>A <a href="qvariant.html">QVariant</a> containing the date
value (<a href="qscriptvalue.html#toDateTime">toDateTime</a>()).</td>
</tr>
<tr class="odd" valign="top">
<td>RegExp Object</td>
<td>A <a href="qvariant.html">QVariant</a> containing the regular
expression value (<a href="qscriptvalue.html#toRegExp">toRegExp</a>()).</td>
</tr>
<tr class="even" valign="top">
<td>Array Object</td>
<td>The array is converted to a <a href="qvariant.html#QVariantList-typedef">QVariantList</a>. Each element
is converted to a <a href="qvariant.html">QVariant</a>,
recursively; cyclic references are not followed.</td>
</tr>
<tr class="odd" valign="top">
<td>Object</td>
<td>The object is converted to a <a href="qvariant.html#QVariantMap-typedef">QVariantMap</a>. Each property
is converted to a <a href="qvariant.html">QVariant</a>,
recursively; cyclic references are not followed.</td>
</tr>
</table>
<p><b>See also</b> <a href="qscriptvalue.html#isVariant">isVariant</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>